package com.ruoyi.web.controller.material;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.IcSapplyB;
import com.ruoyi.system.domain.PoStorereqB;
import com.ruoyi.system.service.IIcSapplyBService;
import com.ruoyi.system.service.IPoStorereqBService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 【请填写功能名称】Controller
 * 
 * @author ruoyi
 * @date 2024-01-06
 */
@Api(tags = "采购申请记录详情")
@RestController
@RequestMapping("/poStorereq/b")
public class PoStorereqBController extends BaseController
{
    @Autowired
    private IPoStorereqBService iPoStorereqBService;

    /**
     * 查询【请填写功能名称】列表
     */
    @ApiOperation("查看采购申请记录详情列表")
    @GetMapping("/list")
    public TableDataInfo list(PoStorereqB poStorereqB)
    {
        startPage();
        List<PoStorereqB> list = iPoStorereqBService.selectPoStorereqBList(poStorereqB);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @ApiOperation("导出采购申请记录详情列表")
    @PostMapping("/export")
    public void export(HttpServletResponse response, PoStorereqB poStorereqB)
    {
        List<PoStorereqB> list = iPoStorereqBService.selectPoStorereqBList(poStorereqB);
        ExcelUtil<PoStorereqB> util = new ExcelUtil<PoStorereqB>(PoStorereqB.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 查询【请填写功能名称】列表
     */
    @ApiOperation("根据采购ID查询采购物资详情")
    @GetMapping("/selectByPid")
    public TableDataInfo selectByPid(String pid)
    {
        startPage();
        PoStorereqB poStorereqB = new PoStorereqB();
        poStorereqB.setPkStorereq(pid);
        List<PoStorereqB> list = iPoStorereqBService.selectPoStorereqBList(poStorereqB);
        return getDataTable(list);
    }
}
